package org.jeecg.modules.jxc.statistical.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.jxc.statistical.entity.JxcPurchaseList;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: jxc_purchase_list
 * @Author: jeecg-boot
 * @Date:   2021-12-20
 * @Version: V1.0
 */
public interface JxcPurchaseListMapper extends BaseMapper<JxcPurchaseList> {

    List<Map<String, Object>> selectSupplierJHAndTHTotalList(@Param("begin") String begin,@Param("end") String end,@Param("state") String state,@Param("key") String key);

    @Select("SELECT jpl.id FROM jxc_purchase_list AS jpl WHERE jpl.purchase_number = #{selectedNumber}")
    String selectJHOneByNumber(String selectedNumber);

    // 根据id 查询进货单列表 类似于父id
    List<Map<String, Object>> selectJHGoodsListDetail(String purchaseId);

    @Select("SELECT jrl.id FROM jxc_return_list AS jrl WHERE jrl.return_number = #{selectedNumber}")
    String selectTHOneByNumber(String selectedNumber);

    // 根据id 查询退货单列表 类似于父id
    List<Map<String, Object>> selectTHGoodsListDetail(String purchaseId);

    @Update("UPDATE jxc_purchase_list set state=1 WHERE id = #{purchaseListId}")
    void updateJHPayStateById(Integer purchaseListId);

    @Update("UPDATE jxc_sale_list set state=1 WHERE id = #{saleListId}")
    void updateXSPayStateById(Integer saleListId);

    List<Map<String, Object>> selectJHTotal(@Param("sTime") String sTime,@Param("eTime") String eTime,@Param("goodsTypeId") Integer goodsTypeId,@Param("codeOrName") String codeOrName);


    List<Map<String, Object>> selectTHTotal(@Param("sTime") String sTime,@Param("eTime") String eTime,@Param("goodsTypeId") Integer goodsTypeId,@Param("codeOrName") String codeOrName);

    List<Map<String, Object>> selectXSTotal(@Param("sTime") String sTime,@Param("eTime") String eTime,@Param("goodsTypeId") Integer goodsTypeId,@Param("codeOrName") String codeOrName);

    List<Map<String, Object>> selectXTTotal(@Param("sTime") String sTime,@Param("eTime") String eTime,@Param("goodsTypeId") Integer goodsTypeId,@Param("codeOrName") String codeOrName);

    List<Map<String, Object>> selectDayProfitList(@Param("sTime") String sTime,@Param("eTime") String eTime);

    List<Map<String, Object>> selectMonthProfitList(@Param("sTime") String sTime,@Param("eTime") String eTime);

    //czq 进货订单查询
    List<Map<String, Object>> selectPurchaseList(@Param("purchaseNumber")String purchaseNumber,@Param("supplierId") Integer supplierId,@Param("state") Integer state,@Param("sTime") String sTime,@Param("eTime") String eTime);

}
